#include <cstdio>
#include <cstring>

const int N = 1000010;
char s1[N], s2[N];
int nxt[N], k;

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
  freopen("KMP.in", "r", stdin);
  freopen("KMP.out", "w", stdout);
#endif
#endif

  scanf("%s", s1 + 1);
  scanf("%s", s2 + 1);
  int len1 = strlen(s1 + 1), len2 = strlen(s2 + 1);
  nxt[1] = 0;
  for (int i = 2; i <= len2; ++i) {
    while (k && s2[i] != s2[k + 1]) k = nxt[k];
    if (s2[i] == s2[k + 1]) k++;
    nxt[i] = k;
  }
  k = 0;
  for (int i = 1; i <= len1; ++i) {
    while (k && s1[i] != s2[k + 1]) k = nxt[k];
    if (s1[i] == s2[k + 1]) k++;
    if (k == len2) {
      printf("%d\n", i - len2 + 1);
      k = nxt[k];
    }
  }
  for (int i = 1; i <= len2; ++i) {
    printf("%d ", nxt[i]);
  }
  return 0;
}